<?php
require_once("dependancy.php");

$oChart = new CHCChart('container');

//titre
$oChart->setTitle('Average temperature');
$oChart->setTitle->setStyle(array('margin' => '10px 100px 0 0', 'color' => 'pink'));

// sous titre
$oChart->setSubTitle('Source: WorldClimate.com');
$oChart->setSubTitle->setStyle(array('margin' => '10px 100px 0 0'));

// X Axis 
$oChart->setXAxis->setCategories(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'));
$oChart->setXAxis->setTitle('Month');

// Y Axis
$oChart->setYAxis->setTitle('Temperature (°C)');
$oChart->setYAxis->addPlotLines('#808080', 0, 1);

// Tooltip
$sTooltipFormatter = "function() {return '<b>'+ this.series.name +'</b><br/>' + this.x +': '+ this.y +' °C';}";
$oChart->setTooltip->setFormatter($sTooltipFormatter);

// Legend
$oChart->setLegend->setLayout('vertical');
$oChart->setLegend->setStyle(array('left' => 'auto', 'bottom' => 'auto', 'right' => '10px', 'top' => '100px'));

// series
$oSerie01 = new CHCSeries();
$oSerie01->setName('Tokyo');
$oSerie01->addPoint(7.0);
$oSerie01->addPoint(6.9);
$oSerie01->addPoint(9.5);
$oSerie01->addPoint(14.5);
$oSerie01->addPoint(18.2);
$oSerie01->addPoint(21.5);
$oSerie01->addPoint(25.2);
$oSerie01->addPoint(26.5);
$oSerie01->addPoint(23.3);
$oSerie01->addPoint(18.3);
$oSerie01->addPoint(13.9);
$oSerie01->addPoint(9.6);


// Serie 02
$oSerie02 = new CHCSeries();
$oSerie02->setName('New York');
$oSerie02->addDataSerie(array(-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5));


// Serie 03
$oSerie03 = new CHCSeries();
$oSerie03->setName('Berlin');
$oSerie03->addDataSerie(array(-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0));


// Serie 04
$oSerie04 = new CHCSeries();
$oSerie04->setName('London');
$oSerie04->addDataSerie(array(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8));


// adding the series to the chart
$oChart->addSerie($oSerie01);
/*$oChart->addSerie($oSerie02);
$oChart->addSerie($oSerie03);
$oChart->addSerie($oSerie04);*/

$sGraph = $oChart->getDisplay();
?>

<html>
	<head>
		<title>Simple Sample Graph</title>
		
		<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="js/highcharts.js" type="text/javascript"></script>
		<script src="js/excanvas.compiled.js" type="text/javascript"></script>
		<?php echo $sGraph; ?>
	</head>
	<body>
		<div id="container"></div>
	</body>
</html>